package cn.tedu.oop;
/** 用于练习OOP的第一大特征.封装*/
public class TestPrivate2 {
    public static void main(String[] args) {
        student s1=new student();
//        s1.name="海绵宝宝";
//        s1.sno=10;
//        s1.subject="洗碗";
//        System.out.println(s1.name);
//        System.out.println(s1.sno);
//        System.out.println(s1.subject);
        student s2=new student();
        s2.study();
        s2.eat();
        s2.sleep();

        s2.setName("派大星");
        s2.setSubject("跳草裙舞");
        System.out.println(s2.getName());
        System.out.println(s2.getSubject());

    }

}
class student{
    int sno;
    private String name;
    private String subject;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public void study(){
        System.out.println("正在学习中....");
    }
    public void eat(){
        System.out.println("正在吃饭....");
    }
    public void sleep(){
        System.out.println("我只想睡觉");
    }
}